package com.xijia;


/**
 * 枚举方式创建
 * @author wangsong
 * @date 2020/9/5 0005 10:21
 * @return
 * @version 1.0.0
 */
public enum Singleton07 {
    INSTANCE;

    public void addUser() {
        System.out.println("我是枚举，我先天性安全");
    }


    Singleton07() {
        System.out.println(">>>Singleton07无参构造函数执行<<");
    }


    public static void main(String[] args) {
        // 只会执行一次构造函数
        System.out.println(Singleton07.INSTANCE == Singleton07.INSTANCE);
    }
}
